<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of cadj</title>
  <meta name="keywords" content="cadj">
  <meta name="description" content="CADJ shifts a vector so that the starting value is always the smallest value.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">
  <script type="text/javascript">
    if (top.frames.length == 0) { top.location = "../../index.html"; };
  </script>
</head>
<body>
<a name="_top"></a>
<!-- # RADOCCToolbox --><!-- menu.html CornerFinder -->
<h1>cadj
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>CADJ shifts a vector so that the starting value is always the smallest value.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>function [vout,xout]=cadj(vin,xin) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre class="comment"> CADJ shifts a vector so that the starting value is always the smallest value.
 
 CADJ shifts the input vector preserving the order in the vector. The
 function ensures that the smallest value is always the first element.
 
 USAGE:
     vout=cadj(vin);
 
     [vout,xout]=cadj(vin,xin); xout is an adjusted version of xin
     according to the adjustment of vin and vout
 
 INPUTS:
     vin: input vector
 
     xin: optional x coordinate vector
 
 OUTPUTS:
     vout: adjusted output vector
 
     xout: adjusted x coordinate vector</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="peakdet.html" class="code" title="function maxtab=peakdet(v)">peakdet</a>	PEAKDET Detect peaks in a vector</li></ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [vout,xout]=cadj(vin,xin)</a>
0002 <span class="comment">% CADJ shifts a vector so that the starting value is always the smallest value.</span>
0003 <span class="comment">%</span>
0004 <span class="comment">% CADJ shifts the input vector preserving the order in the vector. The</span>
0005 <span class="comment">% function ensures that the smallest value is always the first element.</span>
0006 <span class="comment">%</span>
0007 <span class="comment">% USAGE:</span>
0008 <span class="comment">%     vout=cadj(vin);</span>
0009 <span class="comment">%</span>
0010 <span class="comment">%     [vout,xout]=cadj(vin,xin); xout is an adjusted version of xin</span>
0011 <span class="comment">%     according to the adjustment of vin and vout</span>
0012 <span class="comment">%</span>
0013 <span class="comment">% INPUTS:</span>
0014 <span class="comment">%     vin: input vector</span>
0015 <span class="comment">%</span>
0016 <span class="comment">%     xin: optional x coordinate vector</span>
0017 <span class="comment">%</span>
0018 <span class="comment">% OUTPUTS:</span>
0019 <span class="comment">%     vout: adjusted output vector</span>
0020 <span class="comment">%</span>
0021 <span class="comment">%     xout: adjusted x coordinate vector</span>
0022     
0023 [va,loc]=min(vin);
0024 vout=[vin(loc:length(vin)),vin(1:loc-1)];
0025 <span class="keyword">if</span> nargin&gt;1
0026     xout=[xin(loc:length(xin)),xin(1:loc-1)];
0027 <span class="keyword">end</span></pre></div>
<hr><address>Generated on Sun 04-Apr-2010 17:13:59 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2005</address>
</body>
</html>